package com.xinnet.mms.pushhistory.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.xinnet.core.dao.impl.BaseDaoImpl;
import com.xinnet.mms.entity.PushHistory;
import com.xinnet.mms.pushhistory.dao.PushHistoryDao;

@Repository("pushHistoryDao")
public class PushHistoryDaoImpl extends BaseDaoImpl<PushHistory, Long> implements PushHistoryDao{
	/**
	 * 根据客户ID获取推送历史记录
	 */
	public List<PushHistory> getPushHistoryByCustomId(String customId){
		PushHistory pushHistory =new PushHistory();
		pushHistory.setCusId(customId);
		List<PushHistory> pushHistorylList = super.getSqlSession().selectList("pushHistory.getPushHistoryByCustomId", pushHistory);
		if(pushHistorylList!=null && pushHistorylList.size()==0){
			return  null;
		}
		return pushHistorylList;
	}
	
	
	/**
	 * 根据被推送人获取推送记录
	 * @param pushEmpNo
	 * @return
	 */
	public PushHistory  getPushHistoryByPushEmpNo(String pushEmpNo){
		PushHistory tempPushHistory =new PushHistory();
		tempPushHistory.setPushEmpno(pushEmpNo);
		PushHistory pushHistory = super.getSqlSession().selectOne("pushHistory.getPushHistoryByPushEmpNo", tempPushHistory);
		return pushHistory;
	}
	
	public PushHistory getLastPushHistoryByCustomId(String customId){
		PushHistory tempPushHistory =new PushHistory();
		tempPushHistory.setCusId(customId);
		PushHistory pushHistory = super.getSqlSession().selectOne("pushHistory.getLastPushHistoryByCustomId", tempPushHistory);
		return pushHistory;
		
		
	}
}
